package com.cjkj.system.service.impl;

import com.cjkj.common.core.utils.DateUtils;
import com.cjkj.system.api.domain.APIEquipmentUsageRecords;
import com.cjkj.system.domain.TEquipmentUsageRecords;
import com.cjkj.system.mapper.TEquipmentUsageRecordsMapper;
import com.cjkj.system.service.ITEquipmentUsageRecordsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 设备使用记录Service业务层处理
 * 
 * @author cjkj
 * @date 2024-08-30
 */
@Service
public class TEquipmentUsageRecordsServiceImpl implements ITEquipmentUsageRecordsService 
{

    @Resource
    private TEquipmentUsageRecordsMapper tEquipmentUsageRecordsMapper;

    @Override
    public APIEquipmentUsageRecords getRecordsByEquipment(String equipmentNo) {
        return tEquipmentUsageRecordsMapper.selectRecordsByEquipment(equipmentNo);
    }

    /**
     * 查询设备使用记录
     * 
     * @param useId 设备使用记录主键
     * @return 设备使用记录
     */
    @Override
    public TEquipmentUsageRecords selectTEquipmentUsageRecordsByUseId(Long useId)
    {
        return tEquipmentUsageRecordsMapper.selectTEquipmentUsageRecordsByUseId(useId);
    }

    /**
     * 查询设备使用记录列表
     * 
     * @param tEquipmentUsageRecords 设备使用记录
     * @return 设备使用记录
     */
    @Override
    public List<TEquipmentUsageRecords> selectTEquipmentUsageRecordsList(TEquipmentUsageRecords tEquipmentUsageRecords)
    {
        return tEquipmentUsageRecordsMapper.selectTEquipmentUsageRecordsList(tEquipmentUsageRecords);
    }

    /**
     * 修改设备使用记录
     * 
     * @param tEquipmentUsageRecords 设备使用记录
     * @return 结果
     */
    @Override
    public int updateTEquipmentUsageRecords(TEquipmentUsageRecords tEquipmentUsageRecords)
    {
        tEquipmentUsageRecords.setUpdateTime(DateUtils.getNowDate());
        return tEquipmentUsageRecordsMapper.updateTEquipmentUsageRecords(tEquipmentUsageRecords);
    }

    /**
     * 批量删除设备使用记录
     * 
     * @param useIds 需要删除的设备使用记录主键
     * @return 结果
     */
    @Override
    public int deleteTEquipmentUsageRecordsByUseIds(Long[] useIds)
    {
        return tEquipmentUsageRecordsMapper.deleteTEquipmentUsageRecordsByUseIds(useIds);
    }

    /**
     * 删除设备使用记录信息
     * 
     * @param useId 设备使用记录主键
     * @return 结果
     */
    @Override
    public int deleteTEquipmentUsageRecordsByUseId(Long useId)
    {
        return tEquipmentUsageRecordsMapper.deleteTEquipmentUsageRecordsByUseId(useId);
    }
}
